<div class="row-fluid lines" style="padding-top: 20px;padding-bottom: 20px">
<div  style="padding-left: 20px;" >
	<input type="hidden" name="user" value="<?php echo ucfirst($this->common_model->get_username_id($this->session->userdata('user_id')));?>" readonly />
	<span style="font-size: 21px">Dashboard</span>
	<br />
	<span style="font-size: 14px" class="muted">
	<?php
	$now = new DateTime();
	$hr = $now->format('H'); 
	if($hr > 12 AND $hr < 17){
		//echo "Good Afternoon";
	}elseif($hr >= 17 ){
		//echo "Good Evening";
	}	
	else {
		//echo "Good Morning";
	}
	?> 
	<?php echo ucfirst($this->common_model->get_username_id($this->session->userdata('user_id')));?></span>
	<br>
	
</div>
</div>
<br />
<div class="row-fluid">

<div class="span6">	
	<header> <i class="icon-exclamation-sign"></i> To Do </header>
	<table class="table table-condensed table-bordered table-striped">
<?php foreach($todos as $todo) {?>
<tr>
	<td><?php echo $todo->des;?></td>
	
					
					<td width="3%" align="center">
					<?php if($todo->is_completed == 0) {?>
					 <a href="<?php echo site_url('user/to_do/complete/'.$todo->id);?>"><i class="icon-ok-circle muted"></i></a>
					 <?php }else {?>
					 <a href="<?php echo site_url('user/to_do/incomplete/'.$todo->id);?>"><i class="icon-ok-sign text-success"></i></a>
					 <?php }?>
				</td>
				<td width="8%">
					<div class="dropdown">
  <a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="icon-cogs"></i>
  <b class="caret"></b>
  </a>
					<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
						<li><a href="<?php echo site_url('user/to_do/get_todo/'.$todo->id);?>" class="get_todo"><i class="icon-edit"></i> Edit ToDo </a></li>	
						<li><a href="javascript:void(0)" onclick="delete_todo(<?php echo $todo->id?>)"><i class="icon-trash"></i> Delete </a></li>
					 </ul>
					</div>
					</td>
</tr>
<?php }?>
</table>
<a href="<?= site_url('user/to_do/view/'.$this->session->userdata('user_id').'/'.date('m').'/'.date('y'));?>" class="pull-right">All Todo ..</a>
</div>
	
	<!--<?php print_r($client_questions);?>-->
<div class="span6">
	<header> <i class="icon-question-sign"></i> Questions Asked </header>
	<table class="table table-condensed table-bordered">
		<tr>			
			<th width="" ></th>
			<th width="" >Question</th>
			<th>Posted On</th>
		</tr>
		<?php foreach($client_questions as $client_question) {	
			?>
		<tr>		
			<td width="2%"><a href="" class="muted" onclick="answered(<?php echo $client_question->id?>)"><i class="icon-ok-circle"></i></a> </td>		
			<td>
			<a class="tooltips" title="<?php echo $client_question->pName;?>" href="<?php echo site_url('user/tasks/task_detail/'.$client_question->task_id)?>">			
			<?php echo strip_tags(substr($client_question->note,0,60)).'...'?>
			</a>
			</td>
			<td><?php echo $client_question->date?></td>
		</tr>
		<?php }?>
	</table>
	<a href="<?= site_url('client/questions/my_question');?>" class="pull-right">All Questions ..</a>
</div>
	
</div>

<!--Fav Part-->

<div class="row-fluid">
	<div class="span6">
		<header> <i class="icon-tasks text-error"></i> Fav Tasks </header>
		<table class="table table-condensed">
		<thead>
			<tr>
			<th>Title</th>
			<th>Priority</th>
			<th>% Completed</th>
			</tr>
			</thead>
			<?php foreach($fav_tasks as $fav_task){?>
			<tr>
				<td>
<a href="<?php echo site_url('user/tasks/task_detail/'.$fav_task->task_id);?>" class="tooltips" title="<?php echo $fav_task->name;?>" data-placement="top">
<?php echo $fav_task->title?>
</a>
</td>
			<td><?php echo $fav_task->priority?></td>
			<td><?php echo $fav_task->completed_percentage?></td>
			</tr>
			<?php }?>
		</table>
	</div>	
	<div class="span6">
		<header> <i class="icon-folder-open text-error"></i> Fav Projects</header>
		<table class="table table-condensed">
	<thead>
		<tr>
			<th>Project Name</th>
			<!--<th>Team Manager</th>-->
			<th>Due date</th>
			<th>Completed %</th>
		</tr>
	</thead>
	<?php foreach($fav_projects as $fav_project):?>
	<tr>
	<td><a href="<?php
	 echo site_url('user/tasks/milestones_details/'.$fav_project->id) ?>"><?php echo ucfirst($fav_project->name);?></a></td>	
	<td><?php echo $fav_project->end_date;?></td>
	<td>0%</td>
	</tr>
	<?php //echo //$this->encrypt->decode($id);?>
	<?php endforeach;?>	
</table>
	</div>	
</div>

<!--Recent Part-->
<div class="row-fluid">
	<div class="span6">	
		<header> <i class="icon-tasks"></i> Recent Tasks </header>
		<table class="table table-condensed">
		<thead>
		<tr>
			<th>Title</th>
			<th>Priority</th>
			<th>% Completed</th>
		</tr>
		</thead>
		<?php foreach($recent_tasks as $recent_task){?>
		<tr>
			<td>
<a href="<?php echo site_url('user/tasks/task_detail/'.$recent_task->id);?>" class="tooltips" title="<?php echo $recent_task->pName?>">
<?php echo $recent_task->title?>
</a>
</td>
			<td><?php echo $recent_task->priority?></td>
			<td><?php echo $recent_task->completed_percentage?></td>
			
		</tr>
		<?php }?>
		</table>
	</div>
	<div class="span6">
	<header> <i class="icon-folder-open"></i> Recent Projects </header>
	
	<table class="table table-condensed">
	<thead>
		<tr>
			<th>Project Name</th>
			<!--<th>Team Manager</th>-->
			<th>Due date</th>
			<th>Completed %</th>
		</tr>
	</thead>
	<?php foreach($recent_projects as $my_project):?>
	<tr>
	<td><a href="<?php
	 echo site_url('user/tasks/milestones_details/'.$my_project->id) ?>"><?php echo ucfirst($my_project->name);?></a></td>
	<!--<td><?php echo ucfirst($this->common_model->get_username_id($my_project->assigned_to));?>	</td>-->
	<td><?php echo $my_project->end_date;?>	</td>
	<td>0%</td>
	</tr>
	<?php //echo //$this->encrypt->decode($id);?>
	<?php endforeach;?>	
</table>
<small class="pull-right"><a href="<?php echo site_url('client/client/my_projects') ?>" >All Projects..</a>	</small>
	</div>
</div>
<script type="text/javascript">
$('.get_todo').click(function(event) {	
  event.preventDefault();
  $.get(this.href, function(html) {
  $(html).appendTo('body').modal(); 
  });
});	

function answered(str){
	$.post('<?= site_url("client/questions/answered_ajax/");?>',{tId:str}, function(replies) {		
			location.reload();
	})
}
//-->
</script>